package com.ymatou.app.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 获取团数和组团人数Call FreeMaker Template自动生成代码
 */
public class TopicProfileCall extends YmatouBaseCall {
	private static String opurl = "api/Group/TopicProfile";

	public TopicProfileCall() {
		super(EnvSetup.getSystemUrl("api_app"), opurl, "GET", "PARAM");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取code
	 */
	public String getCode() {
		String Code = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Code = String.valueOf(jo.get("Code"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 */
	public String getBCode() {
		String BCode = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			BCode = String.valueOf(jo.get("BCode"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Data
	 * 
	 * @return Data
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Data = jo.getJSONObject("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}

	/**
	 * 获取GroupCount
	 */
	public int getGroupCount() {
		int GroupCount = 0;
		try {
			GroupCount = getData().getInt("GroupCount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return GroupCount;
	}

	/**
	 * 获取MemberCount
	 */
	public int getMemberCount() {
		int MemberCount = 0;
		try {
			MemberCount = getData().getInt("MemberCount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return MemberCount;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			msg = String.valueOf(jo.get("Msg"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return msg;
	}
}